package com.gzucm.Scholarship.dto;

import com.gzucm.Scholarship.common.enums.SystemState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Getter;

import java.util.Objects;

@Getter
@Builder
@ApiModel
public class SystemStateDTO {

    @ApiModelProperty(value = "状态值")
    private SystemState state;

    @ApiModelProperty(value = "信息")
    private String message;

    @ApiModelProperty(value = "是否允许填报")
    private Boolean open;

    public void initOpen() {
        Objects.requireNonNull(state, "初始化属性值open，但SystemState为null");
        open = Objects.equals(SystemState.OPEN_UP, state);
    }

}
